/*
 * @Description:
 * @Version: 1.0
 * @Autor: laikt
 * @Date: 2020-12-30 10:43:50
 * @LastEditors: laikt
 * @LastEditTime: 2021-01-07 10:56:28
 */
import permission from '@/permission'

export default {
    install(Vue) {
        // v-permission=""
        Vue.directive('permission', {
            inserted(el, binding) {
                const { modifiers, value } = binding
                const has = permission(value, modifiers)
                if (!has) {
                    el.parentNode && el.parentNode.removeChild(el)
                }
            }
        })
        // this.$permission()
        Vue.prototype.$permission = permission
    }
}
